import {
  setSchemaTpl,
} from 'amis-editor';
import { Html } from 'amis';
import React from 'react';

setSchemaTpl('apiControl', (patch: any = {}) => {
  const {
    name, label = '接口配置', value, description, data, apiDesc, ...rest
  } = patch;

  return {
    type: 'ae-apiControl',
    label,
    name: name || 'api',
    description: [
      '接口返回实例',
      <Html
        className="ae-ApiSample"
        key="1"
        inline={false}
        html={`
       <pre><code>${JSON.stringify(data, null, 2)}</code></pre>
    `}
      />,
    ],
    ...rest,
  };
});
